package com.hainuo.iotp.expression;

import com.hainuo.iotp.expression.datameta.Variable;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

public class test {

    public static void main(String[] args) {
        if(args.length == 0){
            args = new String[1];
            args[0] = "IK Expression";
        }
        String expression = "(1+1)* 用户名";
//给表达式中的变量“用户名”付上下文的值
        List<Variable> variables = new ArrayList<Variable>();
        variables.add(Variable.createVariable("用户名", 10,null));
        variables.add(Variable.createVariable("hah", "2234",null));
//执行表达式
        Object result = ExpressionEvaluator.evaluate(expression,
                variables);
        System.out.println("Result = " + result);
    }

    public static void main1(String[] args) {

                String expression = "((1+1)>=2)&& ((1+1)>=0)";
//给表达式中的变量“用户名”付上下文的值

        Object result = ExpressionEvaluator.evaluate(expression);
        System.out.println("Result = " + result);
        System.out.println(LocalDateTime.now());
        String expression1 = "1000+100.0*99-(600-3*15)%(((68-9)-3)*2-100)+10000%7*71";
//给表达式中的变量“用户名”付上下文的值

        Object result1 = ExpressionEvaluator.evaluate(expression1);
        System.out.println("Result = " + result1);
        System.out.println(LocalDateTime.now());
    }
}
